cd ~/下载
if [ ! -d "./jdk"]
then
echo "==>installing Java"
wget -c http://101.44.1.119/files/62310000048D816D/download.oracle.com/otn-pub/java/jdk/8u71-b15/jdk-8u71-linux-x64.tar.gz
sudo mkdir /usr/local/jvm
sudo tar zxvf jdk-*.gz -C /usr/local/jvm/
echo "export JAVA_HOME=/usr/local/jvm/jdk1.8.0_71" >> /etc/environment
echo "export JRE_HOME=${JAVA_HOME}/jre" >> /etc/environment
echo "CLASSPATH=${JAVA_HOME}/lib" >> /etc/environment
fi
sudo update-alternatives --install /usr/bin/java java /usr/local/jvm/jdk1.8.0_71/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/local/jvm/jdk1.8.0_71/bin/javac 300
sudo update-alternatives --config java

echo "==>updating current package..."
sudo apt-get update

echo "==>installing jupyter"
sudo pip install jupyter

echo "==>installing OpenCV..."
sudo apt-get install python-opencv

echo "==>installing Matplotlib..."
sudo apt-get install python-tk
sudo apt-get install libpng-dev
wget http://nchc.dl.sourceforge.net/project/freetype/freetype2/2.6.5/freetype-2.6.5.tar.gz
tar zxvf freetype-2.6.5.tar.gz
cd freetype-2.6.5/
./congfigure
make
sudo make install
sudo pip install matplotlib
#安装中文字体: http://blog.163.com/bjcclzw@126/blog/static/129968414201281124457883/
#matplotlib中文问题：http://www.cnblogs.com/ningvsban/p/4345178.html
#rm -r ~/.cache/matplotlib/

echo "==>installing Theano ..."
# some dependencies ...
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
pip install --user --upgrade --no-deps git+https://git.oschina.net/linius/Theano.git

echo "==>installing Lasagne ..."
pip install --user --upgrade --no-deps https://github.com/Lasagne/Lasagne/archive/master.zip

# Packages below this point require downloads. 
mkdir build
cd build

if [ ! -d "./pylearn2" ]
then
echo "==>installing Pylearn2 ..."
# dependencies...
sudo apt-get install libyaml-0-2 python-six
git clone https://git.oschina.net/linius/pylearn2.git
fi
cd ./pylearn2
python setup.py develop --user
cd ..

if [ ! -d "./ALE" ]
then
echo "==>installing ALE ..."

# dependencies ...
sudo apt-get install libsdl1.2-dev libsdl-gfx1.2-dev libsdl-image1.2-dev cmake

git clone https://github.com/mgbellemare/Arcade-Learning-Environment ALE
cd ./ALE
cmake -DUSE_SDL=ON -DUSE_RLGLUE=OFF .
make -j2
pip install --user .
cd ..
fi

echo "==>installing ta-lib"
wget http://downloads.sourceforge.net/project/ta-lib/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz
tar zxvf ta-lib-0.4.0-src.tar.gz ta-lib
cd ta-lib
./configure
make
sudo make install
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
pip install ta-lib --user

echo "==>installing pyaudio mpg123"
sudo apt-get install python-pyaudio mpg123

echo "==>install h5py"
sudo apt-get install libhdf5-dev
sudo pip install h5py

echo "==>installing scikit-learn tushare pandas scikit-image"
pip install scikit-learn pandas tushare scikit-image

echo "installing ideaUI..."
cd ~/下载
wget -c https://d1opms6zj7jotq.cloudfront.net/idea/ideaIU-15.0.3.tar.gz

echo "==>installing keras Cython simplejson pymongo xlrd"
pip install Cython simplejson pymongo xlrd
sudo pip install --upgrade --no-deps git+https://git.oschina.net/linius/keras.git

#Ubuntu不要使用Nvidia官方驱动，要使用ubuntu自带的驱动，否则会导致桌面系统无法进入
#Cuda必须要Root权限才能运行的问题： https://devtalk.nvidia.com/default/topic/701305/linux/cuda-has-to-be-started-as-root-at-least-once-to-work-properly
sudo /home/linius/NVIDIA_CUDA-7.5_Samples/bin/x86_64/linux/release/deviceQuery
sudo modprobe nvidia-uvm
sudo modprobe nvidia

#修改python默认编码
#/etc/python2.x/sitecustomize.py
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

#instal cx_Oracle for python
#11g
#download from https://sourceforge.net/projects/cx-oracle/files/5.1.2/
#解压缩，copy到/usr/local/lib/python2.7/dist-packages
#下载Instant client：http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
#将.so copy到/usr/local/lib
sudo apt-get install libaio1

pip install git+https://git.oschina.net/linius/alphalens.git --user
pip install --extra-index-url https://rquser:ricequant99@py.ricequant.com/simple/ rqdata
#内部用户请注意：rqdata使用了内部的域名解析，请确保你的dns设置为192.168.10.201，search domain为ricequant.com

#ssh配置
#ssh-keygen/ssh-add/ssh-copy-id username@ip
echo "==>All done!"